import 'package:flutter/material.dart';

/// ConstrainedBox 组件约束子组件的最大宽高和最小宽高，
class ConstrainedBoxDemo extends StatelessWidget {
  const ConstrainedBoxDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: Column(
          children: [
            ConstrainedBox(
              constraints: BoxConstraints(maxHeight: 250, maxWidth: 400),
              child: Container(
                height: 500,
                width: 300,
                color: Colors.red,
              ),
            )
          ],
        ),
      ),
    );
  }
}
